  #include <QTextCodec>
#include <QSettings>

//读取
QSettings  configIniRead("Tx2Config.ini", QSettings::IniFormat);
configIniRead.setIniCodec(QTextCodec::codecForName("UTF-8"));
QString ipResult = configIniRead.value("/param/jqd_zhixian_dis").toString();
jqd_zhixian_dis=configIniRead.value("/param/jqd_zhixian_dis").toString().toShort();
//写

   QSettings *configIniWrite = new QSettings("hahaya.ini", QSettings::IniFormat);
   //向ini文件中写入内容,setValue函数的两个参数是键值对
   //向ini文件的第一个节写入内容,ip节下的第一个参数
   configIniWrite->setValue("/ip/first", "192.168.0.1");
   //向ini文件的第一个节写入内容,ip节下的第二个参数
   configIniWrite->setValue("ip/second", "127.0.0.1");
   //向ini文件的第二个节写入内容,port节下的第一个参数
    QSettings configIniWrite ("hahaya.ini", QSettings::IniFormat);
 
   configIniWrite.setValue("/param/enable", ui->timingCalEnableBox->isChecked());